#include "engine_global.h"
#include "version.h"

#include <SDL.h>
#include <SDL_ttf.h>
#include <gl.h>
#include <glu.h>

namespace Lame3d
{
	void EngineInit()
	{
		printf("Starting Lame3d (version is %s)... strap in!\n", VERSION);
		if(SDL_Init(SDL_INIT_VIDEO) == -1) {
			throw "Error in SDL Initialization.";
		}
		SDL_EnableUNICODE(1); // enable unicode translation
		//SDL_WM_GrabInput(SDL_GRAB_ON);
		SDL_ShowCursor(0);
		if(TTF_Init() == -1) {
			throw "Error in SDL_ttf initialization.";
		}
		atexit(EngineQuit);
	}
	
	void EngineQuit()
	{
		SDL_Quit();
		TTF_Quit();
		printf("GL error state: %s\n", gluErrorString(glGetError()));
		printf("Lame3d Exited.  Have a nice day!\n");
		exit(0);
	}
}
